<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
  
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>华农物联网监测系统</title>
   
   
 <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=fdBRnl8rGhbw8u54fcWU94KL"></script>
    <link href="./mycss/mycss.css" rel="stylesheet" type="text/css" />
   
<link href="./themes/default/style.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="./themes/css/core.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="./themes/css/print.css" rel="stylesheet" type="text/css" media="print"/>
<link href="./uploadify/css/uploadify.css" rel="stylesheet" type="text/css" media="screen"/>
<!--[if IE]>
<link href="../themes/css/ieHack.css" rel="stylesheet" type="text/css" media="screen"/>
<![endif]-->

<!--[if lt IE 9]><script src="js/speedup.js" type="text/javascript"></script><script src="js/jquery-1.11.3.min.js" type="text/javascript"></script><![endif]-->
<!--[if gte IE 9]><!--><script src="./js/jquery-2.1.4.min.js" type="text/javascript"></script><!--<![endif]-->

<script src="./js/jquery.cookie.js" type="text/javascript"></script>
<script src="./js/jquery.validate.js" type="text/javascript"></script>
<script src="./js/jquery.bgiframe.js" type="text/javascript"></script>
<script src="./xheditor/xheditor-1.2.2.min.js" type="text/javascript"></script>
<script src="./xheditor/xheditor_lang/zh-cn.js" type="text/javascript"></script>
<script src="./uploadify/scripts/jquery.uploadify.js" type="text/javascript"></script>

<!-- svg图表  supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+ -->
<script type="text/javascript" src="./chart/raphael.js"></script>
<script type="text/javascript" src="./chart/g.raphael.js"></script>
<script type="text/javascript" src="./chart/g.bar.js"></script>
<script type="text/javascript" src="./chart/g.line.js"></script>
<script type="text/javascript" src="./chart/g.pie.js"></script>
<script type="text/javascript" src="./chart/g.dot.js"></script>

<script src="js/dwz.core.js" type="text/javascript"></script>
<script src="js/dwz.util.date.js" type="text/javascript"></script>
<script src="js/dwz.validate.method.js" type="text/javascript"></script>
<script src="js/dwz.barDrag.js" type="text/javascript"></script>
<script src="js/dwz.drag.js" type="text/javascript"></script>
<script src="js/dwz.tree.js" type="text/javascript"></script>
<script src="js/dwz.accordion.js" type="text/javascript"></script>
<script src="js/dwz.ui.js" type="text/javascript"></script>
<script src="js/dwz.theme.js" type="text/javascript"></script>
<script src="js/dwz.switchEnv.js" type="text/javascript"></script>
<script src="js/dwz.alertMsg.js" type="text/javascript"></script>
<script src="js/dwz.contextmenu.js" type="text/javascript"></script>
<script src="js/dwz.navTab.js" type="text/javascript"></script>
<script src="js/dwz.tab.js" type="text/javascript"></script>
<script src="js/dwz.resize.js" type="text/javascript"></script>
<script src="js/dwz.dialog.js" type="text/javascript"></script>
<script src="js/dwz.dialogDrag.js" type="text/javascript"></script>
<script src="js/dwz.sortDrag.js" type="text/javascript"></script>
<script src="js/dwz.cssTable.js" type="text/javascript"></script>
<script src="js/dwz.stable.js" type="text/javascript"></script>
<script src="js/dwz.taskBar.js" type="text/javascript"></script>
<script src="js/dwz.ajax.js" type="text/javascript"></script>
<script src="js/dwz.pagination.js" type="text/javascript"></script>
<script src="js/dwz.database.js" type="text/javascript"></script>
<script src="js/dwz.datepicker.js" type="text/javascript"></script>
<script src="js/dwz.effects.js" type="text/javascript"></script>
<script src="js/dwz.panel.js" type="text/javascript"></script>
<script src="js/dwz.checkbox.js" type="text/javascript"></script>
<script src="js/dwz.history.js" type="text/javascript"></script>
<script src="js/dwz.combox.js" type="text/javascript"></script>
<script src="js/dwz.print.js" type="text/javascript"></script>

<!-- 可以用dwz.min.js替换前面全部dwz.*.js (注意：替换时下面dwz.regional.zh.js还需要引入)
<script src="bin/dwz.min.js" type="text/javascript"></script>
-->
<script src="js/dwz.regional.zh.js" type="text/javascript"></script>

<script type="text/javascript">
$(function(){
	DWZ.init("themes/dwz.frag.xml", {
		loginUrl:"login_dialog.html", loginTitle:"登录",	// 弹出登录对话框
//		loginUrl:"login.html",	// 跳到登录页面
		statusCode:{ok:200, error:300, timeout:301}, //【可选】
		pageInfo:{pageNum:"pageNum", numPerPage:"numPerPage", orderField:"orderField", orderDirection:"orderDirection"}, //【可选】
		keys: {statusCode:"statusCode", message:"message"}, //【可选】
		ui:{hideMode:'offsets'}, //【可选】hideMode:navTab组件切换的隐藏方式，支持的值有’display’，’offsets’负数偏移位置的值，默认值为’display’
		debug:false,	// 调试模式 【true|false】
		callback:function(){
			initEnv();
			$("#themeList").theme({themeBase:"themes"}); // themeBase 相对于index页面的主题base路径
		}
	});
});
</script>
  </head>
  
 <body scroll="no">
	<div id="layout">
		<div id="header">
			<div class="headerNav">
				<img class="logo" src="img/logo.png" />
				<div style=" font-family:黑体; float: left;color: white;font-size: 30px;font-weight: bold;" >
				
				</div>
				<ul class="nav">
					<li id="switchEnvBox"><a href="javascript:">（<span>超级管理员</span>）切换</a>
						<ul>
							<li><a href="sidebar_2.html">广州</a></li>
						</ul>
					</li>
					<li><a href="/pestC/sysIntroduce" target="navTab" width="600">系统介绍</a></li>
					<li><a href="changepwd.html" target="dialog" width="600">设置</a></li>
					<li><a href="./">退出</a></li>
				</ul>
				<ul class="themeList" id="themeList">
					<li theme="default"><div class="selected">蓝色</div></li>
					<li theme="green"><div>绿色</div></li>
					<!--<li theme="red"><div>红色</div></li>-->
					<li theme="purple"><div>紫色</div></li>
					<li theme="silver"><div>银色</div></li>
					<li theme="azure"><div>天蓝</div></li>
				</ul>
			</div>

			<!-- navMenu -->
			
		</div>

		<div id="leftside">
			<div id="sidebar_s">
				<div class="collapse">
					<div class="toggleCollapse"><div></div></div>
				</div>
			</div>
			<div id="sidebar">
				<div class="toggleCollapse"><h2>主菜单</h2><div>收缩</div></div>

				<div class="accordion" fillSpace="sidebar">
					<div class="accordionHeader">
					<h2><span>Folder</span><a onclick="moveCenter(113.420198,23.118505);" style=" display:block;padding:5px 30px 5 3px;" >杨桃公园监测站</a></h2>
					</div>
					<div class="accordionContent">
						<ul class="tree treeFolder">
				
							<li><a target="dialog" height="600" width="900" href="/thingToInternet/mapInfo/yangtao_info1.html">杨桃公园1</a></li>
							<li><a target="dialog" height="600" width="900" href="/thingToInternet/mapInfo/yangtao_info2.html">杨桃公园2</a></li>
							<li><a target="dialog" height="600" width="900" href="/thingToInternet/mapInfo/yangtao_info3.html">杨桃公园3</a></li>
							
						</ul>
					</div>
										<div class="accordionHeader">
					<h2><span>Folder</span><a onclick="moveCenter(113.420808,23.187387);" style=" display:block;padding:5px 30px 5 3px;">广东省农业推广站</a></h2>
					</div>
					<div class="accordionContent">
						<ul class="tree treeFolder">
			
							<li><a target="dialog" height="600" width="900" href="/thingToInternet/mapInfo/shen_info1.html">广东省农业推广站1</a></li>
							<li><a target="dialog" height="600" width="900" href="/thingToInternet/mapInfo/shen_info2.html">广东省农业推广站2</a></li>
							
						</ul>
					</div>
										<div class="accordionHeader">
						<h2><span>Folder</span><a onclick="moveCenter(112.156427,21.901359);" style=" display:block;padding:5px 30px 5 3px;">阳江阳东宝骏猪场</a></h2>
					</div>
					<div class="accordionContent">
						<ul class="tree treeFolder">
					
							<li><a target="dialog" height="900" width="850" href="/thingToInternet/mapInfo/yang_info1.html">宝骏猪场会议室</a></li>
							<li><a target="dialog" height="900" width="850" href="/thingToInternet/mapInfo/yang_info2.html">宝骏猪场全景</a></li>
							<li><a target="dialog" height="900" width="850" href="/thingToInternet/mapInfo/yang_info3.html">宝骏猪场公猪站</a></li>
							<li><a target="dialog" height="900" width="850" href="/thingToInternet/mapInfo/yang_info4.html">宝骏母一配种舍</a></li>
							<li><a target="dialog" height="900" width="850" href="/thingToInternet/mapInfo/yang_info5.html">宝骏猪场大门口</a></li>
							<li><a target="dialog" height="900" width="850" href="/thingToInternet/mapInfo/yang_info6.html">宝骏办公楼大门</a></li>
							
						</ul>
					</div>


					<div class="accordionContent" style="display:none">
						<ul class="tree">
							<li> <a id="mapNodeInfo"  hidden="hidden" target="dialog" height="600" width="900" >隐藏</a></li>
							<li> <a id="mapPigInfo"  hidden="hidden" target="dialog" height="900" width="850" >隐藏</a></li>
	
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div id="container">
			<div id="navTab" class="tabsPage">
				<div class="tabsPageHeader">
					<div class="tabsPageHeaderContent"><!-- 显示左右控制时添加 class="tabsPageHeaderMargin" -->
						<ul class="navTab-tab">
							<li tabid="main" class="main"><a href="javascript:;"><span><span class="home_icon">地图展示</span></span></a></li>
						</ul>
					</div>
					<div class="tabsLeft">left</div><!-- 禁用只需要添加一个样式 class="tabsLeft tabsLeftDisabled" -->
					<div class="tabsRight">right</div><!-- 禁用只需要添加一个样式 class="tabsRight tabsRightDisabled" -->
					<div class="tabsMore">more</div>
				</div>
				<ul class="tabsMoreList">
					<!-- <li><a href="javascript:;">系统介绍</a></li> -->
				</ul>
				<div class="navTab-panel tabsPageContent layoutBox">
					<div class="page unitBox">
						<div class="pageHeader">
	


</div>

<div class="pageContent">
<div id="allmap" style="width:100%;height:1000px; " ></div><!--style="width:100%;height:500px;"  -->
</div>     
     
 <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=fdBRnl8rGhbw8u54fcWU94KL"></script>
 
   
  <script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("allmap");
	map.addControl(new BMap.NavigationControl());               // 添加平移缩放控件
	map.addControl(new BMap.ScaleControl());                    // 添加比例尺控件
	//map.addControl(new BMap.OverviewMapControl());              //添加缩略地图控件
	map.addControl(new BMap.OverviewMapControl({isOpen:true}));
	map.enableScrollWheelZoom();                             //启用滚轮放大缩小
	map.addControl(new BMap.MapTypeControl());               //添加地图类型控件
	var point = new BMap.Point(113.420198,23.118505);   
	map.centerAndZoom(point, 15);
	// 编写自定义函数,创建标注
		var opts = {
				width : 250,     // 信息窗口宽度
				height: 80,     // 信息窗口高度
				title : "信息窗口" , // 信息窗口标题
				enableMessage:true//设置允许信息窗发送短息
			   };
	showPestClick();
	showPigClick();
	     

	function addClickHandler(content,marker){
		marker.addEventListener("click",function(e){
			//openInfo(content,e);
			openNodeInfo(content,e);
			}
		);
	}
	
		function addClickHandler2(content,marker){
		marker.addEventListener("click",function(e){
			//openInfo(content,e);
			openNodeInfo2(content,e);
			}
		);
	}
	
	
	function openInfo(content,e){
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	
	function openNodeInfo(content,e){
		//alert(content);
		$("#mapNodeInfo").attr("href",function(){ return content;});
		//alert($("#mapNodeInfo").attr("href"));
		$("#mapNodeInfo").click();
	
	}
	
		function openNodeInfo2(content,e){
		//alert(content);
		$("#mapPigInfo").attr("href",function(){ return content;});
		//alert($("#mapNodeInfo").attr("href"));
		$("#mapPigInfo").click();
	
	}

	function showPestClick(){
	 $.getJSON("/thingToInternet/mapInfo/mapinfo.json",function(data){
             $.each(data,function(idx,obj){
                 var marker = new BMap.Marker(new BMap.Point(obj.location_x,obj.location_y));  // 创建标注

		         var content = obj.path;
		         map.addOverlay(marker);               // 将标注添加到地图中
	         	addClickHandler(content,marker);
				
				var point =new BMap.Point(obj.location_x,obj.location_y);
				var opts = {
	                    position : point,    // 指定文本标注所在的地理位置
	                    offset   : new BMap.Size(10, -10)    //设置文本偏移量
	                   }
				var label = new BMap.Label(obj.nodeName, opts);  // 创建文本标注对象
				label.setStyle({
			       color : "red",
			       fontSize : "12px",
			       height : "20px",
			       lineHeight : "20px",
			       fontFamily:"微软雅黑"
		             });
				map.addOverlay(label); 
        		});

       });
       }
	   
	   	function showPigClick(){
	 $.getJSON("/thingToInternet/mapInfo/piginfo.json",function(data){
             $.each(data,function(idx,obj){
                 var marker = new BMap.Marker(new BMap.Point(obj.location_x,obj.location_y));  // 创建标注

		         var content = obj.path;
		         map.addOverlay(marker);               // 将标注添加到地图中
	         	addClickHandler2(content,marker);
				
				
				var point =new BMap.Point(obj.location_x,obj.location_y);
				var opts = {
	                    position : point,    // 指定文本标注所在的地理位置
	                    offset   : new BMap.Size(10, -10)    //设置文本偏移量
	                   }
				var label = new BMap.Label(obj.nodeName, opts);  // 创建文本标注对象
				label.setStyle({
			       color : "red",
			       fontSize : "12px",
			       height : "20px",
			       lineHeight : "20px",
			       fontFamily:"微软雅黑"
		             });
				map.addOverlay(label); 
        		});				
        		

       });
       }
	   
	function moveCenter(l_x,l_y)
	{
	   map.panTo(new BMap.Point(l_x,l_y));
	}

	

	
</script> 
						
						
					
					</div>
					
				</div>
			</div>
		</div>

	</div>

	<div id="footer">Copyright &copy; 2016 <a href="demo_page2.html" target="dialog">华南农业大学数学与信息学院 </a> WSN640</div>


</body>
</html>

